${page.setTitle("push-center| GOPS")}
<style type="text/css">
    .l-table-edit {}
    .l-table-edit-td{ padding:4px;}
    .l-button-submit,.l-button-reset{width:80px; float:left; margin-left:10px; padding-bottom:2px;}
</style>
${token()}
<div class="body-pla-content">
  <form action="" method="post" id="domainAppchannel" name="domainAppchannel">
        <table class="l-table-edit" >
            <tr>
                <td align="right" >域：</td>
                <td align="left" >
						<input name="domainId" type="hidden" id="domainId"  maxlength="30" value=""  validate="{required:true,maxlength:30}"/>
						<input name="domainName" type="text" id="domainName"  maxlength="30" value=""  validate="{required:true,maxlength:30}"/>
				</td>
               
			 </tr> 
			 
			 <tr>
			 	 <td align="right" >渠道：</td>
                <td align="left" >
						<input name="appId" type="text" id="appId"  maxlength="30" value=""  validate="{required:true,maxlength:30}"/>
						<input name="appChannelId" type="hidden" id="appChannelId"  maxlength="30" value=""  validate="{required:true,maxlength:30}"/>
				</td>
			 </tr>
             <tr>
				 <td align="right" >备注：</td>
                <td align="left">
                <textarea rows="3" cols="40" name="memo" id="memo" ></textarea>
				</td>
            </tr>  
            <tr>
            	<td></td>
            	<td > <input type="button" value="新增" id="dosubmit" class="l-button l-button-submit"/>  </td>
            	<td align="left"></td>
            </tr>
        </table>
    </form>
</div>
<script type="text/javascript">

$(function () {
	$("#dosubmit").click(function(){
		var queryString = $('#domainAppchannel').serializeArray(); 
	    $.ajax({
	        url: "${appServer}/domainappchannel/add.json",   
	        data: queryString, 
	        type: "POST",
	        success: function(result) {
	        	if(result.hasError) {
					$.ligerDialog.error(result.message);
	        	}else{
	        		$.ligerDialog.success(result.message);
	        		parent.window.search();
	        		parent.$.ligerDialog.close();
	        		parent.$.ligerDialog.hide();
	        	}
	        }
	    });	
		return true;
	});
	
});

//-----------------------domain-name---start---
	  $(function ()
        { 
            $("#domainName").ligerComboBox({
                onBeforeOpen: f_selectContact,width:135
            });
        });
        function f_selectContact()
        {
            $.ligerDialog.open({ title: ' ++选择域', name:'winselector',width: 550, height: 400,  url: '${appServer}/domain/listall-domain', buttons: [
                { text: '确定', onclick: f_selectContactOK },
                { text: '取消', onclick: f_selectContactCancel }
            ]
            });
            return false;
        }
        function f_selectContactOK(item, dialog)
        {
			var fn = dialog.frame.f_select || dialog.frame.window.f_select; 
            var data = fn(); 
            if (!data)
            {
                alert('请选择行!');
                return;
            }
            $("#domainName").val(data.name);
            $("#domainId").val(data.id);
            dialog.close();
        }
        function f_selectContactCancel(item, dialog)
        {
            dialog.close();
        }

//-----------------------domain-name---end---

//------------------------------------------appchannel---start------

 $(function ()
        { 
            $("#appId").ligerComboBox({
                onBeforeOpen: f_selectContact2,width:135
            });
        });
        function f_selectContact2()
        {
            $.ligerDialog.open({ title: ' ++选择渠道', name:'winselector',width: 550, height: 400,  url: '${appServer}/channel/listall-appid', buttons: [
                { text: '确定', onclick: f_selectContactOK2 },
                { text: '取消', onclick: f_selectContactCancel2 }
            ]
            });
            return false;
        }
        function f_selectContactOK2(item, dialog)
        {
			var fn = dialog.frame.f_select || dialog.frame.window.f_select; 
            var data = fn(); 
            if (!data)
            {
                alert('请选择行!');
                return;
            }
            $("#appId").val(data.appId);
            $("#appChannelId").val(data.id);
            dialog.close();
        }
        function f_selectContactCancel2(item, dialog)
        {
            dialog.close();
        }
        

//------------------------------------------appchannel---end------

</script>